{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c74f610b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "cb3cd1dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "path = os.path.abspath('')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "63ebe360",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'E:\\\\pycharm_out\\\\yufa\\\\git_test'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1290de15",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_file = os.listdir(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "0d6fd2d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['.git',\n",
       " '.gitee',\n",
       " '.ipynb_checkpoints',\n",
       " '.vscode',\n",
       " 'def_test.ipynb',\n",
       " 'def_test2.ipynb',\n",
       " 'der.ipynb',\n",
       " 'dict_推导式.ipynb',\n",
       " 'for_test.py',\n",
       " 'for_test02.py',\n",
       " 'lambda_test.ipynb',\n",
       " 'LICENSE',\n",
       " 'list_txt.ipynb',\n",
       " 'logging_test.ipynb',\n",
       " 'main.py',\n",
       " 'os_path_test.ipynb',\n",
       " 'os_test.py',\n",
       " 'test.ipynb',\n",
       " 'try.ipynb',\n",
       " 'with open.ipynb',\n",
       " 'with open文件输入输出.ipynb',\n",
       " '字符串格式化.ipynb',\n",
       " '报错.txt',\n",
       " '推导式.ipynb',\n",
       " '文件夹信息.txt',\n",
       " '文件夹信息1.txt']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list_file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "3fb6865b",
   "metadata": {},
   "outputs": [],
   "source": [
    "txt_name = []\n",
    "for i in list_file:\n",
    "    if i.endswith('.txt'):\n",
    "        txt_name.append(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b6cfae5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['报错.txt', '文件夹信息.txt', '文件夹信息1.txt']"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "txt_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "2bf62175",
   "metadata": {},
   "outputs": [],
   "source": [
    "for y in txt_name:\n",
    "    dir_path = os.path.join(path, y)\n",
    "    os.startfile(dir_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b0da5874",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
